#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "W25Q64.h"
//#include "OLED_Font.h"
//11-1 软件SPI读写W25Q64

uint8_t MID;
uint16_t DID;
uint8_t ArrayW[]={0x01,0x02,0x03,0x04};
uint8_t ArrayR[4];

int main(void){
	OLED_Init();						//OLED初始化
	W25Q64_Init();						//W25Q64初始化
	Delay_ms(1000); 
	W25Q64_ReadID(&MID, &DID);			//获取W25Q64的ID号
	OLED_ShowHexNum(1, 5, MID, 2);		//显示MID
	OLED_ShowHexNum(1, 12, DID, 4);		//显示DID
		/*W25Q64功能函数测试*/
	//W25Q64_SectorErase(0x000000);					//扇区擦除
	W25Q64_Pageprogram(0x000000, ArrayW, 4);	//将写入数据的测试数组写入到W25Q64中
	
	W25Q64_ReadData(0x000000, ArrayR, 4);		//读取刚写入的测试数据到读取数据的测试数组中
	
	/*显示数据*/
	OLED_ShowHexNum(2, 3, ArrayW[0], 2);		//显示写入数据的测试数组
	OLED_ShowHexNum(2, 6, ArrayW[1], 2);
	OLED_ShowHexNum(2, 9, ArrayW[2], 2);
	OLED_ShowHexNum(2, 12,ArrayW[3], 2);
	
	OLED_ShowHexNum(3, 3, ArrayR[0], 2);			//显示读取数据的测试数组
	OLED_ShowHexNum(3, 6, ArrayR[1], 2);
	OLED_ShowHexNum(3, 9, ArrayR[2], 2);
	OLED_ShowHexNum(3, 12, ArrayR[3], 2);
	while(1){

	}
}
